import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
    {
    title: '标题',
    align:"center",
    dataIndex: 'title'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderAvatar,
   },
   {
    title: '开始时间',
    align:"center",
    dataIndex: 'begindate'
   },
   {
    title: '结束时间',
    align:"center",
    dataIndex: 'enddate'
   },
   {
    title: '地点',
    align:"center",
    dataIndex: 'location'
   },
   {
    title: '是否链接',
    align:"center",
    dataIndex: 'isLink',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '链接',
    align:"center",
    dataIndex: 'url'
   },
   {
    title: '内容',
    align:"center",
    dataIndex: 'content',
    slots: { customRender: 'htmlSlot' },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "标题",
      field: "title",
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "开始时间",
      field: "begindate",
      component: 'DatePicker',
      componentProps: {
         showTime:true
       },
      colProps: {span: 6},
 	},
	{
      label: "结束时间",
      field: "enddate",
      component: 'DatePicker',
      componentProps: {
         showTime:true
       },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'img',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '开始时间',
    field: 'begindate',
    component: 'Input',
  },
  {
    label: '结束时间',
    field: 'enddate',
    component: 'Input',
  },
  {
    label: '地点',
    field: 'location',
    component: 'Input',
  },
  {
    label: '是否链接',
    field: 'isLink',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '链接',
    field: 'url',
    component: 'InputTextArea',//TODO 注意string转换问题
  },
  {
    label: '内容',
    field: 'content',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
];
